# ！ /usr/bin/python3
# -*- coding:utf-8 -*-
# @Author:Peng Cao
# @File: 07new_边缘检测.py
# @Software: PyCharm
import cv2.cv2 as cv
import matplotlib.pyplot as plt
import numpy as np


def img_pyrUp():
    """
    图像金字塔--上采样
    :return:
    """
    img = cv.imread('./data/AM.png')
    new_img = cv.pyrUp(img)
    cv.imshow("new_img", new_img)
    cv.waitKey(0)
    cv.destroyAllWindows()
    return new_img


def img_pyrDown():
    """
    图像金字塔--下采样
    :return:
    """
    img = cv.imread('./data/AM.png')
    new_img = cv.pyrDown(img)
    cv.imshow("new_img", new_img)
    cv.waitKey(0)
    cv.destroyAllWindows()
    return new_img


def img_lpl():
    """
    拉普拉斯金字塔
    :return:
    """
    img = cv.imread('./data/AM.png')
    new_img = cv.pyrDown(img)
    new_img = cv.pyrUp(new_img)
    new_img = img-new_img
    cv.imshow("new_img", new_img)
    cv.waitKey(0)
    cv.destroyAllWindows()


if __name__ == '__main__':
    # img_pyrUp()
    # img_pyrDown()
    img_lpl()
